package com.kfm.service.impl;

import com.kfm.dao.AccountDao;
import com.kfm.model.Account;
import com.kfm.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;

// 这个类是 spring 的 bean
//@Component
@Service // 业务层 bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@Lazy
public class AccountServiceImpl implements AccountService {

//    @Autowired
//    @Qualifier("accountDaoImpl2")
//    @Resource(name = "dao")
    @Inject
    @Named("dao")
    private AccountDao dao;


//    @Value("${jdbc.driver}")
//    public String a;

    public AccountDao getDao() {
        return this.dao;
    }

//    public String getA() {
//        return a;
//    }

    @Override
    public int save(Account account) {
        return dao.insert(account);
    }
}
